package com.mrsltec.springwebandroid;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.widget.LinearLayout;

import com.mrsltec.springwebandroid.controller.MainSpringWebController;

public class MainSpringWeb extends AppCompatActivity {



    private MainSpringWebController controller;

    private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
            = new BottomNavigationView.OnNavigationItemSelectedListener() {

        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            switch (item.getItemId()) {
                case R.id.navigation_home:
                    controller.togglePages(0);
                    return true;
                case R.id.navigation_choose:
                    controller.togglePages(1);
                    return true;
                case R.id.navigation_heavy:
                    controller.togglePages(2);
                    return true;
                case R.id.navigation_me:
                    controller.togglePages(3);
                    return true;
            }
            return false;
        }

    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_spring_web);
        this.controller = new MainSpringWebController(this);

        BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
        navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);



        this.controller.initView();
    }


}
